package cn.com.surker.vo.sale;

import cn.com.surker.enums.ICodeDescEnum;
import cn.com.surker.enums.sale.ContractCategoryEnum;
import cn.com.surker.sale.entity.SaleContract;
import cn.com.surker.util.StringUtils;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.lang.invoke.ConstantCallSite;
import java.util.List;
import java.util.Map;

/**
 * @Author lucky
 * @create 2024年08月07 21:55
 * @desc
 */
@Data
public class SaleContractVo extends SaleContract implements Serializable {

    private String clientName;

    private String taxCode;

	private String fullConName;

	public String getFullConName() {
		String f1 = "";
		if (StringUtils.isNotBlank(getSales())) {
			f1 = getSales() + "-";
		}
		String f2 = "";
		if (StringUtils.isNotBlank(clientName)) {
			f2 = clientName;
		}
		String f3 = "";
		if (StringUtils.isNotBlank(getName())) {
			// f2 = "【" + getName() + "】";
			f3 = "[" + getName() + "]";

		}
		String f4 = "";
		ContractCategoryEnum categoryEnum = ICodeDescEnum.getEnum(ContractCategoryEnum.class, getContractCategory());
		if (categoryEnum != null) {
			f4 = "-" + categoryEnum.getDescription();
		}
		this.fullConName = f1 + f2 + f3 + f4;

		return fullConName;
	}

	private String contractCategoryTxt;

	public String getContractCategoryTxt() {
		@NotNull(message = "请选择合同类型") Integer contractCategory = getContractCategory();
		ContractCategoryEnum anEnum = ICodeDescEnum.getEnum(ContractCategoryEnum.class, contractCategory);
		if (anEnum != null) {
			return anEnum.getDescription();
		} else {
			return "";
		}
	}
}
